package com.lzy.pattern.observer.jdk;

import java.util.Observable;
import java.util.Observer;

/**
 * @ClassName: police
 * @Description: TODO
 * @Author: LiuZy
 * @Date: 2022/5/1 16:39
 * @Version: 1.0
 */
public class Police implements Observer {
    private String name;
    public Police(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        System.out.println(String.format("我是警察%s，我盯你这个小偷很久了，你叫%s，你说的话将作为呈堂证供。", this.name, ((Thief)o).getName()));
    }
}